import request from '@/axios'
import { TableData } from './types'

export const getTableListApi = (params: any) => {
  return request.get({ url: '/admin/cpfl', params })
}

export const getTableListCountApi = (params: any) => {
  return request.get({ url: '/admin/cpfl-count', params })
}

export const delTableListApi = (ids: string[] | number[]): Promise<IResponse> => {
  return request.post({ url: '/admin/cpfl-delete', data: { ids } })
}

export const getTableDetApi = (id: string): Promise<IResponse<TableData>> => {
  return request.get({ url: '/admin/cpfl', params: { id } })
}

export const saveTableApi = (data: Partial<TableData> | any): Promise<IResponse> => {
  return request.post({ url: '/admin/cpfl', data })
}

export const putTableApi = (data: Partial<TableData> | any): Promise<IResponse> => {
  return request.put({ url: '/admin/cpfl', data })
}
